import axios from '@/utils/axios'

export const getApp = (id: number): Promise<ApiResult<BaseApp>> => {
    return axios.get(`base/app/${id}`)
}

export const getAppPage = (pagination: Pagination, params: BaseApp): Promise<ApiResult<Page<BaseApp>>> => {
    return axios.get(`base/app/page/${pagination.page}/${pagination.pageSize}`, { params })
}

export const getAppList = (): Promise<ApiResult<Array<BaseApp>>> => {
    return axios.get(`base/app/list`)
}

export const postOrPutApp = (data: BaseApp): Promise<ApiResult<null>> => {
    return axios.post(`base/app`, data)
}

export const deleteApp = (id: number): Promise<ApiResult<null>> => {
    return axios.delete(`base/app/${id}`)
}
